package homeworks.cjt2010.homework1;
import java.io.File;
import java.util.Collection;
import java.util.Date;
/**
 * Interface for your airport controller.
 * 
 * @author Kristiyan Marinov
 * @author Filip Yankov
 * 
 */
public interface AirportManager {
/**
 * Gets all flights leaving this airport and arriving at the specified 
one.
 * 
 * @param to
 *            destination airport
 * @return collection of all the flights from the current airport to the
 *         destination
 * @throws IllegalArgumentException
 *             if there is no such airport present (not a part of the 
enum)
 */
public Collection<Flight> getFlights(Airport to);
/**
 * Books tickets for the specified person(s). If there is <b>only</b> one
 * person specified, the returned collection should contain only one newly
 * created ticket, with its price reduced based on how much frequent flyer
 * miles the passenger has (5% for >= 100000, 10% for >=1000000). If more
 * than one person is specified, than the collection must contain
 * personalized tickets for each person. Based on the size of the group,
 * some discounts are offered: <5 people: no discount >=5 && <10 people: 
10%
 * discount >=10 people: 15% discount These discounts should be noted in 
the
 * price of the issued ticket. Frequent flyer discount occurs <b>only</b>
 * when a single passanger is traveling. Groups do <b>NOT</b> get frequent
 * flyer discount on top of the group discount.
 * The booked tickets are for the specified class;
 * @param flight
 * @param person
 *            people for which tickets should be issued
 * @return collection issued tickets
 * @throws IllegalArgumentException
 *             if the flight is non-existent or already departed the 
airport (has status DEPARTED or CANCELED)
 */
public Collection<Ticket> bookTicket(Flight flight, FlightClass 
flightclass, Passenger... person)
throws IllegalArgumentException;
/**
 * Fetches flight info for the specified flight. The result is in the 
format"DEP yyyy-m-dd hh:mm:ss|ARR yyyy-m-dd hh:mm:ss|SRC XXX|DEST YYY|PLANE 
<airplaneName>"
 * For example, a valid flight info string is:"DEP 2010-4-20 20:15:00|ARR 
2010-4-20 21:20:00|SRC SOF|DEST BGY|PLANE Airbus A320"
 * 
 * @param flight
 *            the flight for which to fetch the info
 * @return string containing the flight info in the specified format or an *         empty string if there is no such flight in the system.
 */
public String flightInfo(Flight flight);
/**
 * Gets the status of the specified flight.
 * 
 * @param flight
 * @return a FlightStatus enum constant, depicting the current flight 
status
 * @throws NoSuchFlightException
 *             if there is no such flight in the system
 */
public FlightStatus getFlightStatus(Flight flight);
/**
 * Adds new flight(s) to the system. Upon adding the flights, passengers
 * should be able to purchase tickets for them. Flights that are already
 * registered, but are present in the specified ones should ignored. 
Flights
 * should automatically be recognized as departing or arriving based on
 * their source & destination airports. For example, arriving flights are
 * such that their destination airport is the current one (the one this
 * system is associated with).
 * 
 * @param flights
 * @return true if the process finished successfully (which includes no 
flights beign added), false otherwise
 */
public boolean registerFlights(Flight... flights);
/**
 * Removes a flight from the system. All tickets associated with the 
flight
 * should be destroyed.
 * 
 * @param flight
 * @return true if the process was successful, false otherwise
 */
public boolean unregisterFlight(Flight flight);
/**
 * Returns a collection of all the tickets for a specified flight.
 * 
 * @param flight
 * @return 
 * @throws NoSuchFlightException
 *             if there is no such flight present in the system
 */
public Collection<Ticket> getPurchasedTickets(Flight flight);
/**
 * Destroys the old ticked issued to the customer and issues a new one 
with
 * the same personal data, with the exception of the new flight. If
 * <i>newFlight</i> is given as <b>null</b> upon invocation, this means 
that
 * the customer wants to return the ticket and not get a new one. In this
 * case the old ticket should be destroyed and no new ticket should be
 * returned.
 * 
 * @param oldTicket
 *            the current ticket of the passenger
 * @param newFlight *            the flight for which the passenger wants a new ticket
 * @return the newly created ticket if <i>newFlight</i> is not null, or 
null
 *         otherwise
 * @throws NoSuchFlightException
 *             if there is no such flight in the system
 */
public Ticket rescheduleFlight(Ticket oldTicket, Flight newFlight) throws 
NoSuchFlightException;
/**
 * Returns a sorted collection of all the flights departing the current
 * airport between the two specified dates. The collection should be 
ordered
 * by departing time.
 * 
 * @param from
 *            starting date
 * @param to
 *            end date
 * @return a collection of flights between the two dates
 */
public Collection<Flight> getDepartingFlights(Date from, Date to);
/**
 * Returns a sorted collection of all the flights departing the current
 * airport between the two specified dates. The collection should be 
ordered
 * by arrival time.
 * 
 * @param from
 *            starting date
 * @param to
 *            end date
 * @return a collection of flights between the two dates
 */
public Collection<Flight> getArrivingFlights(Date from, Date to);
/**
 * Checks in the baggage for the person holding the specified ticket.
 * If the ticket already has checked in baggage, the new baggage should be 
 * added to the previously checked in one.
 * @param ticket
 * @param baggage
 *            baggage to check in
 * @throws IllegalArgumentException
 *             if the specified ticked is not valid (it is not present in
 *             the system as created) or null
 */
public void checkInBaggage(Ticket ticket, Object... baggage);
/**
 * Retrieves the checked in baggage for the specified person.
 * 
 * @param ticket
 * @throws IllegalArgumentException
 *             if there is no such ticket in the system (it is not present
 *             as created)
 * @return an array of the checked in objects
 */
public Object[] getBaggage(Ticket ticket) throws IllegalArgumentException;
       /**
 * Saves the current state of the airport manager to a file for persistent storage.
 * The state includes: current flights, purchased tickets, flight statuses 
and checked in baggage.
 * 
 * @param f file to save to
 * @return true if successful, false otherwise
 */
public boolean store(File f);
/**
 * Loads the airport manager and initializes it to the state, saved in the 
file specified.
 * @param f to load the state from
 * @return true if successful, false otherwise
 */
public boolean load(File f);
}